package com.ebt.m.proposal_v2.bean;

import android.text.TextUtils;

import com.ebt.m.proposal_v2.utils.Utils;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 计划书预览传递参数
 *
 * @author archer.qi
 *         Created on 2017/5/18.
 */
public class ArgProposalDetail implements Serializable {

    /* 计划书ID*/
    public String proposalId;

    /* 计划书名称*/
    public String proposalName;

    /* 投保人姓名*/
    public String applicantName;

    /* 预览链接*/
    public String previewUrl;

    /* 分享链接*/
    public String shareUrl;

    /* 分享到微信链接*/
    public String shareUrlWeXin;

    /* 是否是新建计划书*/
    public boolean isNewProposal;

    /* 计划书是否已发送*/
    public boolean isProposalPosted;

    /**
     * 检查分享条件是否满足
     *
     * @return
     */
    public boolean checkShare() {
        if (TextUtils.isEmpty(proposalName)) {
            return false;
        }
        if (TextUtils.isEmpty(applicantName)) {
            return false;
        }
        if (TextUtils.isEmpty(shareUrl)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        Map<String, Object> mapper = new HashMap<>();
        mapper.put("proposalId", proposalId);
        mapper.put("proposalName", proposalName);
        mapper.put("applicantName", applicantName);
        mapper.put("previewUrl", previewUrl);
        mapper.put("shareUrl", shareUrl);
        mapper.put("shareUrlWeXin", shareUrlWeXin);
        return "->计划书预览参数： \n" + Utils.toString(mapper);
    }
}
